#include "ArmyData.h"




ArmyData::ArmyData(int id, int type, double x, double y, Rect* rangeOfEffect)
{
	this->id = id;
	this->type = type;
	this->rangeOfEffect = rangeOfEffect;
	// test gun
	this->rect = new Rect(x, y, 70, 70);
	this->targetRect = NULL;
	this->isHalf = false;
}

void ArmyData::initSpriteHandler(LPD3DXSPRITE spriteHandler)
{
	sprites->initSpriteHandler(spriteHandler);
}

void ArmyData::initSpriteHandler()
{
	sprites = new Sprites(getRect());
	sprites->initSpriteHandler(*(GameDeviceSingleton::getInstance()->getSpriteHandler()));
}

bool ArmyData::_checkInRange()
{
	return abs(rect->X - targetRect->X) < rangeOfEffect->Width && abs(rect->Y - targetRect->Y) < rangeOfEffect->Width;
}

bool ArmyData::checkTargetAhead()
{
	return rect->X - targetRect->X  > -10;
}
